﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;
using Yugi.Client.Card;
using System.Threading;


namespace ServerYuGi
{
    public partial class SSupervisor
    {
        void Process_CARD_DOITRANGTHAI(params object[] param)
        {
            //YBaseCard card = param[0] as YBaseCard;
            int IDCard = (int)param[0];
            SPlayer player = LayPlayer(TurnManager.IDPlayerTrongLuot);
            SPlayer playerother = LayPlayerKhacVoiPlayerDangTrongLuot();
            SCard tmp = player.LayCardTrenBan(IDCard);
            YBaseCard card = tmp.MyYBaseCard;           

            YMSG TrangThai = (YMSG)param[1];
            switch (TrangThai)
            {
                case YMSG.CARD_TRANGTHAI_DUNG_MO:
                    if (card.CardType == YType.Normal)                   
                        tmp.TrangThai = YMSG.CARD_TRANGTHAI_NAM_MO;                     
                    break;
                case YMSG.CARD_TRANGTHAI_DUNG_UP:
                    if (card.CardType == YType.Spell || card.CardType == YType.Trap)                  
                        tmp.TrangThai = YMSG.CARD_TRANGTHAI_DUNG_MO;                  
                    break;
                case YMSG.CARD_TRANGTHAI_NAM_MO:
                    if (card.CardType == YType.Normal)                   
                        tmp.TrangThai = YMSG.CARD_TRANGTHAI_DUNG_MO;                
                    break;
                case YMSG.CARD_TRANGTHAI_NAM_UP:
                    if (card.CardType == YType.Normal)                   
                        tmp.TrangThai = YMSG.CARD_TRANGTHAI_DUNG_MO;                
                    break;
                
            }
            ServerSocket.SendMessageToID(playerother.ID,YMSG.CARD_DOITRANGTHAI_XONG, IDCard, tmp.TrangThai);
        }
    }
}
